1. Field of the Invention
The present invention relates to computer systems and, more specifically, to a system and method for providing online data backup.
2. Background and Description of Related Art
Typically, the operating system of a computer system includes a file system to provide users with an interface while working with data on the computer system's disk and to provide the shared use of files by several users and processes. Generally, the term “file system” encompasses the totality of all files on the disk and the sets of data structures used to manage files, such as, for example, file directories, file descriptors, free and used disk space allocation tables, and the like. Accordingly, end users generally regard the computer file system as being composed of files and a number of directories. Each file usually stores data and is associated with a symbolic name. Each directory may contain subdirectories, files or both. The files and directories are typically stored on a disk or similar storage device. File systems may provide several functions. As discussed above, the most basic task of a file system is provide access to files. File systems may also enhance system performance with additional functions such as, for example, caching, access markers and fault-tolerance.
Operating systems such as UNIX, Linux and Microsoft Windows manage computer file systems by defining a file object hierarchy. A file object hierarchy begins with a root directory and proceeds down the file tree. The file address is then described as an access path, e.g., a succession of directories and subdirectories leading to the file. This process of assigning a file address is called access path analysis or path traverse. For instance, the path “/r/a/b/file” contains the root directory (/), subdirectories “r”, “a” and “b” and then the file. Typically, the processes within an operating system interact with the file system with a regular set of functions. For example, these functions usually include open, close, write and other system calls. For instance, a file may be opened by the open functions and this function acquires the file name as a target.
The file system may also include intermediate data structures containing data associated with the file system to facilitate file access. This data is called metadata and may include, for example, data corresponding to the memory location of the files, e.g., where the file is located in the hard drive or other storage medium. For example, in the context of a UNIX operating system, these intermediate data structures are called “inodes,” i.e., index-node. An inode is a data structure that contains information about files in UNIX file systems. Each file has an inode and is identified by an inode number (e.g., i-number) in the file system where it resides. The inodes provide important information on files such as user and group ownership, access mode (read, write, execute permissions) and type. The inodes are created when a file system is created. There are a set number of inodes, which corresponds to the maximum number of files the system can hold.
Generally, a file system architecture that provides a recoverable file system is preferable to conventional file systems that lack this feature. In conventional systems, careful write and lazy write are the two main approaches to implementing input-output support and caching in file systems. Typically, careful write is implemented in file systems developed for VAX/VMS and other similar closed operating systems. Lazy write is generally implemented in the HPFS (High Performance File System) of the OS/2 operating system and in most UNIX file systems.
In the event of an operating system failure or power supply interruption, for example, input-output operations performed at that time are immediately interrupted. Depending on what operations were performed and how far the execution of these operations had advanced, such interruption may affect the integrity of the file system. Violation of file system integrity may adversely affect the system's ability to locate and access files. For instance, a given file name may be present in the directory list, but the file system may not be able to find this file and access its content. In the most serious case, damage to the file system may lead to the loss of an entire volume of data. A file system that implements careful write does not necessarily prevent violation of file system integrity. Instead, the system implementing careful write arranges records so that any system failure, in the worst case, may only cause unpredictable, non-critical mismatches that the file system can eliminate at any time.
When a file system of any type receives a request for renewal of disk content, the file system must perform several sub-operations before the renewal can be completed. In file systems using the strategy of careful write, these sub-operations always write their data onto the disk. When allocating disk space, e.g., for a file, the file system first sets the appropriate number of bits in its bit card, and then allocates space for the file. If a power supply interruption occurs immediately after those bits have been set, the file system with careful write loses access to that part of the disk, which was represented with the pre-set bits, but the existent data is not destroyed. Sorting write operations also means that input-output requests are performed in the order of arrival. If one process allocates disk space and soon afterwards the other process creates a file, the file system with careful write will complete allocation of the disk space before starting the creation of the file—otherwise the overlap of sub-operations from two input-output requests might lead to the violation of file system integrity.
The FAT (file allocation table) file system in MS-DOS uses the through-write algorithm, in which renewals are performed immediately, e.g., the cache memory is written to at the same time as main memory. Unlike careful write, this method does not demand input operations sorting from the file system to prevent a violation of integrity. The main advantage of file systems with careful write is that, in case of a failure, the disk volume remains intact and can still be used—an intermediate launch of a volume recovery utility is not required. A volume recovery utility is needed for correction of predictable, non-destructive failures of the disk integrity that occur as a result of a failure. But this type of utility can generally be run at any time, usually when the system reboots. However, file systems with careful write have some disadvantages such as, for example, low performance, redundant non-optimized accesses to a disk, among other drawbacks.
A file system utilizing the careful write policy generally sacrifices its performance for reliability. On the other hand, a file system with lazy write typically increase performance due to the strategy of write-back caching. Write-back caching is a caching method in which modifications to data in the cache aren't copied to the cache source until absolutely necessary. This method of caching using the lazy write policy provides several advantages over the careful write policy which accordingly increases system performance. First, the number of write operations to the disk may be reduced. Because write operations are immediately performed, input operations are not required and the buffer's content may change several times before being written onto the disk. Second, the speed of servicing application requests sharply increases because the file system may return control to the calling program without waiting for the write to the disk to be completed. Finally, the strategy of lazy write ignores intermediate inconsistent states of a volume that generally occur when several input-output requests overlap in time. This policy therefore simplifies the creation of a multi-threaded file system, which allows simultaneous execution of several input-output operations.
But one disadvantage of the lazy write method is that, in some instances, a volume may acquire such an inconsistent state that the file system is unable to correct the volume in the event of a failure. Therefore, file systems with lazy write must always track the volume state. In general, a lazy write provides greater performance in comparison to the careful write policy but at the price of greater risk and user discomfort in the event of a system failure.
Recoverable file systems, such as, for example, Microsoft NTFS (Windows NT File System), may provide greater reliability than file systems with careful write, but also provide the performance of file systems with lazy write. Recoverable file systems guarantee integrity of the volume by using a journal of changes to handle transactions. For example, a journaled file system (JFS) is a file system in which the hard disk maintains data integrity in the event of a system crash or if the system is otherwise halted abnormally. The journaled file system maintains a log, or journal, of what activity has taken place in the main data areas of the disk. If a crash occurs, any lost data can be recreated because updates to the metadata in directories and bit maps have been written to a serial log. The journaled file system not only returns the data to the pre-crash configuration but also recovers unsaved data and stores it in the location in which it would have been stored if the system had not been unexpectedly interrupted. Accordingly, because recoverable file systems register all disk write operations in the journal, recovery may take only several seconds regardless of the volume size. The recovery procedure is generally precise and guarantees the return of the volume to the consistent state, in contrast to the typically inadequate recovery results of file systems with the lazy write policy, for example.
But the high reliability of the recoverable file system has its disadvantages. For each transaction that modifies the volume structure, the file system must enter one record into the journal file for each transaction sub-operation. The integration of journal file records into packets may increase the efficiency of the file system: for each input-output operation, several records may be simultaneously added to the journal. Moreover, the recoverable file system may use optimization algorithms, such as those used by file systems utilizing lazy write. The file system may also increase the intervals between writing the cache contents to the disk, because the file system can be recovered if a failure occurs before the modifications are copied from cache to the disk. The utilization of these tactics to improve performance generally compensates for and may even exceed the performance losses incurred by protocolling the transactions.
But, neither careful write nor lazy write can guarantee protection of user data. If a system failure occurs at the moment an application writes to a file, then the file may be lost or destroyed. Moreover, in the case of a lazy write policy, the failure may damage the file system because the lazy write policy may have destroyed existing files or even made all information on the volume unavailable.
In contrast, recoverable file systems, such as, for example, Windows NTFS, possesses greater reliability in comparison with traditional file systems. First, recoverability of NTFS guarantees that the structure of the volume will not be destroyed because, in case of the system failure, all files will remain available. Second, although NTFS does not guarantee safety of user data in case of the system failure because some modifications in cache can be lost, applications can use the advantages of a write-through policy and NTFS cache reset to guarantee that the modifications of any files will be written to the disk at the required time. Both write-through (e.g., the policy requires an immediate write to the disk) and cache reset (e.g., a forced write of the cache content to the disk) are quite effective operations. NTFS does not require additional input-output to write modifications of several various data structures of the file system to the disk, because changes in these structures are registered in the journal file (e.g., during one write operation). If a failure occurs and the cache content is lost, modifications of the file system can be recovered using information from the file journal. Moreover, NTFS, unlike FAT, guarantees that, after the write-through or cache reset operation are completed, user data will stay safe and will be available even if a system failure occurs afterwards.
Generally, NTFS supports recovery of the file system using the concept of an atomic transaction. An atomic transaction is an operation in which either all steps in the operation succeed, or they all fail, e.g., either all actions of the transaction happen or none happen. Atomic transactions are commonly used to perform data modifications in a data store, where either all the data relating to the operation is successfully modified, or none of it is modified and the data remains as it was before the operation started. Accordingly, single changes on the disk composing a transaction may be performed atomically, e.g., during the transaction, all required changes are to be moved to disk. If the transaction is interrupted by a file system failure, modifications performed by the current moment are cancelled. After back-off, the database returns to the initial consistent state that it possessed before the transaction began.
Note that journaling is not a panacea for this type of system failure. For example, a user may open a file and place a large volume of data into the file. In the middle of a write operation, a failure occurs and the system reboots. And, after recovery, the file will typically be empty—all the information that the user wrote into the file since the file was open has disappeared. Thus, journaling file systems are not designed for recovery of data at any price, but are instead dedicated to provide non-contradiction of file system metadata at the moment of failure. In particular, this type of system typically operates as follows: a user opens a file and if it opens successfully, the file system notes opening in its journal by recording a transaction. Then the user may start writing. But the file system does not record copies of this data. Accordingly, after failure recovery is completed, the back-off procedure restores the last successful transaction that occurred, e.g., the opening of a new empty file.
Examples of journaled file systems include ReiserFS, JFS, XFS (Extended File System), ext3 and NTFS. A journaling file system may relocate the journal to another independent device to provide asynchronous access for the purposes of optimization. For instance, XFS and ReiserFS may use relocated journals.
XFS was created by Silicon Graphics (now SGI) for multimedia computers with the Irix OS. XFS is oriented to very large files and file systems. During journal construction, some metadata of the file system itself are written to the journal such that the entire recovery process is reduced to copying these data from the journal into the file system. Accordingly, the size of the journal is set when the system is created and is generally large, e.g., cannot be less than 32 Mb.
JFS was created by IBM for the AIX OS. OS/2 and Linux versions of JFS also exist. The journal size is typically about 40% of the file system size, but not larger than 32 Mb. This file system may contain several segments including the journal and data, and each of such segments can be mounted separately, e.g., “aggregates.”
ReiserFS is an experimental file system designed for speed and survivability. The first prototype was called TreeFS. Currently, this system exists only for the Linux OS. Ext3 is the journaled superstructure for ext2 (Second-Extended File System)—the main and the most reliable file system for OS Linux. At present, this system is mainly developed by RedHat. One advantage of ext3 is that it does not alter the internal structure of ext2. The ext3 file system can be created from ext2 by running a journal creation program. An ext2 driver and an ext3 driver may be subsequently used to mount the file system and create the journal.
The development of file systems demonstrates that fault-tolerance and recoverability of file systems after failures are very important design considerations. To provide the maximum reliability, it is necessary to periodically copy all files as a immediate copy or cast of the file system, e.g., a snapshot. By its functionality, a snapshot is very similar to the journal of a recoverable file system, as they can both restore the system to the integral state. A snapshot guarantees full data recovery, but incurs high expenses in creation and storage.
Snapshot creation generally involves sector by sector copying of the whole file system, i.e., service information and data. If the file system is currently active, then files may be modified during copying—some files can be open for writing or locked, for example. In the simplest case, the file system can be suspended for some time and during that time a snapshot is recorded. Of course, such an approach cannot be applied to servers where uninterruptible activity of the file system is necessary.
Conventional file systems provide mechanisms to create snapshots without interrupting the operation of the file system. The following example is based on the Episode file system. Episode is designed to utilize the disk bandwidth efficiently, and to scale well with improvements in disk capacity and speed. Episode utilizes the meta-data logging to obtain good performance, and to restart quickly after a crash. Episode uses a layered architecture and a generalization of files called containers to implement file-sets. A file-set is a logical file system representing a connected sub-tree, e.g., logical elements representing a linked tree. File-sets are the unit of administration, replication, and backup in Episode. The design of Episode allows disposal of several ‘file-sets’ on one partition. The process of file-set cloning is used to create snapshots. The file-set clone is a snapshot, as well as a file-set, that can share data with the original file-set due to the copy-on-write techniques. The cloned file-set is available for reading only and it is generally placed on the same partition as the original file-set (e.g., available for reading and writing). Clones may be created very quickly and, most importantly, without interrupting access to data being copied. Cloning is accomplished by cloning all ‘anodes’ to ‘file-sets’. In this context, an anode is similar to a ‘mode’ in BSD (the Berkeley Software Design version of Unix) with some minor distinctions. After copying each anode, both file-sets (new and old) point to the same data block. But the reference to the disk in the original ‘anode’ acquires the COW (copy-on-write) flag, such that, during block modification, a new data block is created (at which point the COW flag is removed).
Generally, under a COW policy, when the system copies a string, the “real” string to be copied (e.g., its content or bytes) is not actually copied in memory with the copy operation. Instead, a new string is created and marked as COW, and it points to the original string. When the system reads this flagged string, it is redirected to the original string. In the event an application wishes to write to the string (e.g., modify it), then the system notes the COW flag and performs the actual copying of bytes. The COW approach saves memory, because the system may create as many copies of a string as desired without requiring multiple allocations (unless they are modified). COW also improves the speed of the system, because the system requires less resources to copy a string under the COW methodology.
As a result, this file system allows the user to sort in time the changes that occur in the file system. This can be achieved because all modifications performed in the file system (or in any part of it) during a given period of time are written to a separate tree. These separate trees may be sorted in time and represent a full version of the file system modifications. Thus, to find the file state at a given moment, a user may search sequentially through the required file in the tree closest in time, e.g., if the desired file state was not found there, the user may search in the previous tree, etc.
Snapshots are also implemented in the WAFL (Write Anywhere File Layout) file system. WAFL is designed for network file servers. The main purpose of WAFL algorithms and data structures is to support snapshots, which, in this case, may be “read-only” file system clones. To minimize the disk space required by the snapshot, WAFL uses the copy-on-write technology. Moreover, WAFL snapshots may obviate the necessity of checking the file system integrity after a failure, which allows the file server to quickly start.
Typically, WAFL automatically creates and deletes snapshots according to a defined schedule and keeps a selected number of snapshot copies to provide access to old files. The copy-on-write technology is used to prevent doubling of disk blocks (in the snapshot and active file system). Only when the block in the file system is modified, will the snapshot containing this block be committed to disk space. Users may access the snapshots via NFS (Network File System). An administrator can use snapshots to create backup copies independently of the file system operation.
FIG. 1 illustrates the file system structure of a conventional WAFL system. As illustrated in FIG. 1, WAFL stores metadata in files and uses three types of files: (1) an ‘node’ file, containing ‘node’ for the file system; (2) a block map file, which identifies spare blocks and (3) an inode file map, identifying a spare inode. In this context, the term “map,” not “bitmap,” is used as these files may use more than one bit for each record. By storing metadata in files, a WAFL system may write blocks of metadata to any place on the disk. This design allows the system to use copy-on-write technology during the creation of snapshots, e.g., the WAFL system writes all data, including metadata, to a new place on the disk, without re-writing old data. Note that if the WAFL system could store data to any fixed place on the disk, this process would not be possible.
As shown on FIG. 1, the structure of a WAFL system may be represented as a tree of blocks, shown generally at 10, with a root inode 15 pointing to the inode file 20, and with metadata and files placed below. The root inode 15 is in the root of the file tree 10. The root inode 15 is a specific inode describing the inode file 20. The inode file 20 contains inodes describing other files in the file system, including the block map and inode map files, 25 and 30, respectively. The data blocks of all files form the “leaves” of the tree. FIG. 2 is a more detailed version of FIG. 1. FIG. 2 illustrates that files are composed of separate blocks and large files have additional links between modes and real data blocks. Loading the WAFL system requires locating the root of the file system tree. Accordingly, the block containing the root inode 15 is an exception to the rule “write to any place.” The block containing the root inode 15 should be located in a fixed place on the disk.
FIG. 3 illustrates the creation of a snapshot in WAFL. In order to create a virtual copy of a tree of blocks, WAFL simply copies the root inode 15. This process is depicted on FIG. 3. FIG. 3a is a simplified version of the original file system in which internal nodes of the tree, such as inodes and indirect blocks, are omitted for clarity. FIG. 3b shows the process in which WAFL creates a new snapshot 35 by copying the root inode 15. The copied inode 35 becomes the root in the tree of blocks and it represents a snapshot of the root inode 15 in the same way a root inode 15 represents the real file system. When the snapshot's inode 35 is created, it points to the same disk blocks, shown generally at 40, as the root inode 15. Therefore, WAFL does not change a snapshot's blocks because it copies new data to the new place on the disk. Accordingly, a new snapshot does not take additional disk space (excluding the space taken to create the snapshot's inode).
FIG. 3c depicts the situation when a user modifies a data block 40, e.g., data block D. WAFL writes new data to the block D′ on the disk and modifies the pointer to point to the new block in the active file system. The snapshot 35 continues to point to the old block D, which remains unmodified on the disk. As files are modified or deleted in the active file system, the snapshot 35 refers to the growing amount of blocks, instead of being associated with the active file system. Moreover, the snapshot 35 will take more and more disk space.
Different file systems have different methods for creating snapshots. For example, the manner in which snapshots are created in WAFL provides advantages over the corresponding process of Episode. In Episode, instead of copying the root mode, a copy of the whole inode file is created. This significantly loads the disk subsystem and consumes a lot of disk space. For example, a 10 Gb file system with one inode per each 4 Kb of disk space will allocate 320 Mb for an inode. Accordingly, in this type of file system, creation of a snapshot through inode file copying will generate 320 Mb of disk traffic and take 320 Mb of disk space. Creation of ten such snapshots will take nearly one third of the free disk space, after taking the modification of blocks into account. In contrast, by copying the root inode, WAFL quickly creates a snapshot without overloading the disk subsystem. This advantage is important, because WAFL creates snapshots every several seconds to implement a mechanism of recovery after failures.
FIG. 4 shows transition from FIGS. 3b to 3c in more detail. When a disk block is modified, all of its content is relocated to a new location. Accordingly, the block's parent must also be updated or modified to point to a new location. In addition, the parent's parent must also be re-written to a new location and so on.
If the file system performed a write for several blocks at each modification, the system would incur substantial performance penalties. Instead, WAFL caches several hundreds of modifications before writing. During the write, WAFL allocates disk space for all data in cache and performs a disk operation. As a result, blocks that are often modified, such as indirect blocks or inode file blocks, are written once during cache reset instead of each time the data is modified.
Accordingly, due to the disadvantages associated with conventional data backup systems, there is a need for a data backup process that is both reliable and efficient. Moreover, there is a need for an online data backup process that allows a computer system to remain online while data is being backed-up and also addresses the disadvantages associated with conventional back-up systems.